package psd.scala.rules

import scala.collection.mutable

import psd.model.Bug
import psd.scala.FactDb
class ShortBehaviourClass {

  	def execute(db: FactDb): mutable.ArrayBuffer[Bug]= {
    
	    val result = new mutable.ArrayBuffer[Bug]
		val classDefTList = db.classDefTList
	    
		for ( i <- classDefTList ) {
		   if (i.methodCount < 4)  {
		     val bug = new Bug
		     bug.set_lineNumber(i.line.toInt)
		     bug.set_path(i.path)
	    	 bug.set_ruleName(this.getClass().toString())
	    	 result+=bug
		   }
		}
	    
		if (result.size > 20)
			return result
		else
			return new mutable.ArrayBuffer[Bug]
	
  	}
  	
}